Create table ForumPosts_Tmp
   (PostID                int            not null identity
   ,CategoryID            int            not null
   ,ParentPostID          int
   ,PostType              nvarchar(20)
   ,GroupID               int
   ,Subject               nvarchar(400)
   ,Body                  ntext
   ,CreateDate            datetime        not null
   ,Status                varchar(10)
   ,Summary               nvarchar(2000)
   ,Type                  varchar(50)
   ,UserID                int
   ,NumberOfVisits        int
   ,PartnerID             int
   ,OriginAuthor          nvarchar(200)
   ,URL                   nvarchar(500)
   ,Rating                int
   ,EditBy                int
   ,ApproveDate           datetime
   ,ApproveBy             int
   ,RecommendDate         datetime
   ,RecommendBy           nvarchar(200)
   ,PublishDate           datetime
   ,CreatedBy             int
   ,CreatedDateTime       datetime
   ,LastModifiedBy        int
   ,LastModifiedDateTime  datetime
constraint pk_ForumPost_Tmp primary key (PostID))

create table Groups(GroupID              int           not null 
identity
                   ,name                 nvarchar(100) not null
                   ,description          nvarchar(500)
                   ,CreatedBy            int           not null
                   ,CreatedDateTime      datetime
                   ,LastModifiedBy       int
                   ,LastModifiedDateTime datetime
constraint pk_Group primary key (GroupID))

create table GroupUsers(GroupUserID          int           not null 
identity
                       ,UserID               int not null
                       ,CreatedBy            int           not null
                       ,CreatedDateTime      datetime
                       ,LastModifiedBy       int
                       ,LastModifiedDateTime datetime
constraint pk_GroupUser primary key (GroupUserID, UserID))

select *
into   Category_Tmp
from   dbo.Category

select * from Category_Tmp

if exists (select * from dbo.sysobjects where id = 
object_id(N'[dbo].[Category]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
   drop table [dbo].[Category]
GO

CREATE TABLE [dbo].[Category]([CategoryID]            [int] IDENTITY    
NOT NULL
                             ,[CategoryCode]          [nvarchar] (50)   
NOT NULL
                             ,[Description]           [nvarchar] (255)  
NULL
                             ,[Type]                  [varchar]  (20)   
NULL
                             ,[Location]              [nvarchar] (1000) 
NULL
                             ,[CreatedBy]             [varchar]  (128)  
NOT NULL 
                             ,[CreatedDateTime]       [datetime]        
NOT NULL
                             ,[LastModifiedBy]        [varchar]  (128)  
NOT NULL 
                             ,[LastModifiedDateTime]  [datetime]        
NOT NULL
    CONSTRAINT PK_Category PRIMARY KEY(CategoryID)
) ON [PRIMARY]
GO

set identity_insert Category on
GO

insert into Category
         (CategoryID
         ,CategoryCode
         ,Description
         ,Type
         ,Location
         ,CreatedBy
         ,CreatedDateTime
         ,LastModifiedBy
         ,LastModifiedDateTime)
   select CategoryID
         ,CategoryCode
         ,Description
         ,null
         ,Location
         ,CreatedBy
         ,CreatedDateTime
         ,LastModifiedBy
         ,LastModifiedDateTime
   from   Category_Tmp

set identity_insert Category off
GO

select * from Category

ALTER TABLE ForumPosts_Tmp ADD CONSTRAINT FK_ForumPostsCategory FOREIGN 
KEY (CategoryID)
   REFERENCES Category(CategoryID)
GO

drop table Category_Tmp
go